package de.mk.model;

import java.util.Properties;

import de.mk.util.ArrayUtils;

public class Board {

	private int numOfCards = 0;
	Picture[] pictures;;

	public Board(Properties props) {
		this.numOfCards = Integer.valueOf(props.getProperty("size"));;
		pictures = new Picture[numOfCards];
		for (int i = 0; i < numOfCards; i++) {
			pictures[i] = new Picture();
		}		
		setRandomPicturePosition();
	}

	private void setRandomPicturePosition() {
		int[] randomPos = ArrayUtils.getRandomIntegerArray(numOfCards);
		for (int i = 0; i < numOfCards; i++) {
			pictures[i].setPosition(randomPos[i]);
		}
	}

	public int getNumOfCards() {
		return numOfCards;
	}

	public void setNumOfCards(int numOfCards) {
		this.numOfCards = numOfCards;
	}

	public Picture[] getPictures() {
		return pictures;
	}
	
	public Picture getPicture(int index) {
		return pictures[index];
	}

	public void setPictures(Picture[] pictures) {
		this.pictures = pictures;
	}

}
